package com.vdm.service.impl;

import com.vdm.dao.UserInfoMapper;
import com.vdm.model.UserInfo;
import com.vdm.service.UserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserINfoServiceImpl implements UserInfoService {

    @Autowired
    UserInfoMapper userInfoMapper;

    @Override
    public UserInfo getUserByLoginName(String loginName) {
        return userInfoMapper.selectByLoginName(loginName);
    }

    @Override
    public List<UserInfo> userList() {
        return userInfoMapper.listUser();
    }

    @Override
    public int getUserCount() {
        return userInfoMapper.getUserCount();
    }

    @Override
    public int updateUserStatus(List<Integer> ids, Integer type) {
        if (ids != null && ids.size() > 0) {
            return userInfoMapper.updateUserStatus(ids, type);
        } else {
            return 0;
        }
    }

    @Override
    public int updateByPk(UserInfo user) {
        return userInfoMapper.updateByPrimaryKeySelective(user);
    }

    @Override
    public int insertSelective(UserInfo record) {
        return userInfoMapper.insertSelective(record);
    }
}
